/**
 * file
 */
package com.tdkj.action.front.member.spaceManagement;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionContext;
import com.tdkj.action.BaseAction;
import com.tdkj.model.enterprisezone.BeanEnterprise;
import com.tdkj.model.user.BeanUser;
import com.tdkj.service.enterprisezone.IBeanEnterpriseService;
import com.tdkj.util.PublicConfing;

/**

 * FileName:     ContactAction.java

 * @Description: TODO联系方式

 * All rights Reserved, Designed By ZTE-ITS

 * Copyright:    Copyright(C) 2010-2011

 * Company       天成科技有限公司

 * @author:    李兴建

 * @version    V1.0 

 * Createdate:         2012-5-27 上午11:48:33

 *

 * Modification  History:

 * Date         Author        Version        Discription

 * -----------------------------------------------------------------------------------

 * 2012-5-27       李兴建          1.0             1.0

 * Why & What is modified: <修改原因描述>

 */
public class ContactAction extends BaseAction {
	private BeanUser user;
	private BeanEnterprise enterprise;
	private IBeanEnterpriseService enterpriseService;
	@Override
	public String execute(){
		user =  (BeanUser) ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		enterprise = user.getEnterprise();
		enterprise = enterpriseService.findById(enterprise.getId(), BeanEnterprise.class);
		return "success";
	}
	
	public String update(){
		user =  (BeanUser) ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		
		BeanEnterprise enterpriseOld = user.getEnterprise();
		enterpriseService.updateContactWay(enterpriseOld.getId(), enterprise.getName(), enterprise.getAddress(), enterprise.getContactPeople(), enterprise.getQq(), enterprise.getEmail(), enterprise.getPhone(), enterprise.getFax(), enterprise.getZipCode(), enterprise.getSiteUrl(), enterprise.getBriefIntroduce());
		return "success";
	}

	public BeanEnterprise getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(BeanEnterprise enterprise) {
		this.enterprise = enterprise;
	}

	@Resource
	public void setEnterpriseService(IBeanEnterpriseService enterpriseService) {
		this.enterpriseService = enterpriseService;
	}

}
